home *** CD-ROM | disk | FTP | other *** search
/ Aminet 24 / Aminet 24 (1998)(GTI - Schatztruhe)[!][Apr 1998].iso / Aminet / biz / cloan / pprx_WAD.lha / WebAnimDesigner1_2d / WebAnimDesigner.pprx < prev    next >
Text File  |  1998-01-20  |  34KB  |  1,136 lines

  1. /* Personal Paint Amiga Rexx script - Copyright © 1997-8, Andres Paabo. 'SaveAnimGif.pprx 1.7 script is copyright Cloanto (see bottom  portion  of this script)*/
  2.  
  3. /* $VER: WebAnimDesigner.pprx 1.2d */
  4.  
  5. /** ENG
  6.  This script is intended to assist in the creation of animated gifs for web pages.
  7.  NOTE this program does not create animated gifs itslf. It only helps design the anim or
  8.  animbrush that is used as a source for creating the animated gifs. The animated gifs
  9.  have to be created with other programs such as Cloanto's DefineAnimGif.pprx and
  10.  SaveAnimGif.pprx. However since this runs on Personal Paint. and for convenience, this
  11.  script will call on Personal Paint's 'SaveAnimGif.pprx' (in slightly modified form) and
  12.  pass information to it.
  13. */
  14.  
  15.  
  16.  
  17. IF ARG(1, EXISTS) THEN
  18.     PARSE ARG PPPORT
  19. ELSE
  20.     PPPORT = 'PPAINT'
  21.  
  22. IF ~SHOW('P', PPPORT) THEN DO
  23.     IF EXISTS('PPaint:PPaint') THEN DO
  24.         ADDRESS COMMAND 'Run >NIL: PPaint:PPaint'
  25.         DO 30 WHILE ~SHOW('P',PPPORT)
  26.              ADDRESS COMMAND 'Wait >NIL: 1 SEC'
  27.         END
  28.     END
  29.     ELSE DO
  30.         SAY "Personal Paint could not be loaded."
  31.         EXIT 10
  32.     END
  33. END
  34.  
  35. IF ~SHOW('P', PPPORT) THEN DO
  36.     SAY 'Personal Paint Rexx port could not be opened'
  37.     EXIT 10
  38. END
  39.  
  40. ADDRESS VALUE PPPORT
  41. OPTIONS RESULTS
  42. OPTIONS FAILAT 10000
  43.  
  44.  
  45.  
  46.  
  47.  
  48. /*********ANIM IS SET UP****WHAT TO DO NEXT***************************/
  49.  
  50.  
  51. openWAD= getclip('openWAD')
  52.  if openWAD = "" then DO
  53. /*******************ENSURES SCREEN NOT TOO SMALL & STUFF IS WITHIN SCREEN*****************/
  54. accept = 0
  55. GET 'SCREENW'
  56. scw = result
  57. if scw >= 640 then DO
  58.     GET 'SCREENH'
  59. sch = result
  60.     if sch >= 400 then DO
  61.         GET 'IMAGEW'
  62.             imgw = result
  63.             if imgw <= scw then DO
  64.             GET 'IMAGEH'
  65.             imgh = result
  66.                 if imgh <= sch then accept = 1
  67. END
  68. END
  69. END
  70. if accept = 0 then  DO
  71.     Requestnotify 'TITLE "CHANGE SCREEN or IMAGE SIZE" PROMPT  "For viewability, screen
  72.  size must be 640x 400 or greater, and image size equal or less the screen size"'
  73.     EXIT 0
  74.     END
  75. /********/
  76. call setclip('openWAD', 1)
  77.  
  78. END
  79. /********THE ABOVE IS DONE ONLY AT VERY START****IF OPENWAD =""****/
  80.  
  81. numcolors2=getclip('numcolors2')
  82. GET 'COLORS'
  83. numcolors=result 
  84. if numcolors = 256 then DO; RequestResponse 'PROMPT "You must start on the source page.
  85.  Proceed if okay. Cancel if not."';if rc~=0 then EXIT 0;END  
  86. if numcolors = numcolors2 then DO
  87.  switchenvironment
  88.  GET 'COLORS'
  89.  numcolors=result
  90. end
  91.  
  92. SETFRAMEPOSITION 1
  93. Set '"BARS=0"'
  94. REQUESTER:
  95. txt_gad_title = 'WEB ANIM DESIGNER 1.2 by A.Paabo for use with Personal Paint 7.+'
  96. txt_gad_transp = 'transparency'
  97. txt_gad_dispose = 'dispose'
  98. txt_gad_optimize = 'Optimization:'
  99. txt_gad_optimnone = '1.None (Constant size & position)'
  100. txt_gad_optimdelta = '3.Deltas (Varying size & position)'
  101. txt_gad_optimbndy= '2.Boundaries (Varying size & position)'
  102. txt_gad_operation = 'SELECT OPERATION:'
  103. txtnew = 'WEBANIMDESIGNER OPERATES ON THE CURRENT ANIMATION'
  104. txt_gad_preview = '1.SIMULATE animgif in 2nd environment'
  105. txt_gad_anbrush = 'Special Operations '
  106. txt_gad_anbrushnone = '(When selected, overrides above operations)'
  107. txt_gad_pickup = '2.pick up web anim as annotated animbrush'
  108. txt_gad_animload = '1.make current animbrush into WAD anim'
  109. txt_gad_removecolor = '3.make-no background color in object'
  110. txt_gad_final = '2.MAKE ANIMGIF via Cloanto SaveAnimGif'
  111. txt_gad_drawrect = 'simulation:show frame rectangles'
  112. txt_gad_curglobal = 'define global rectangle'
  113. txt_gad_curglobal0 = '(use current global rectangle)  '
  114. txt_gad_curglobal1 = '1.let WAD determine new from anim'
  115. txt_gad_curglobal2 = '2. User-define new with mouse'
  116. txt_gad_loop = 'loops (0=endless):'
  117.  
  118. transpcol = getclip('transpcol'); if transpcol = "" then transpcol=0
  119. X0 = getclip('X0')
  120. Y0 = getclip('Y0')
  121. X1 = getclip('X1')
  122. Y1 = getclip('Y1')
  123. GETFRAMES
  124. frames=result 
  125.  
  126. transp=getclip('transp')
  127.  if transp = "" then transp = 1
  128. dispose = getclip('dispose')
  129.  if dispose = "" then dispose = 1
  130. optimization= getclip('optimization')
  131.  if optimization="" then optimization = 0
  132. drawrect= getclip('drawrect')
  133.  if drawrect="" then drawrect=1
  134. /*curglobal = getclip('curglobal')
  135.  if curglobal="" then*/
  136.  curglobal=0
  137.  anbrush=0
  138. loop = getclip('loop')
  139. if loop = "" then loop = 0
  140. operation = getclip('operation')
  141. if operation = "" then operation =0 
  142. Request '"'txt_gad_title'" ' ||,
  143.     ' "TEXT = ""'txtnew'"" '||,
  144.     ' INTSTR = ""'txt_gad_loop'"", 0, 32767, 'loop' ' ||,
  145.    ' CHECK = ""'txt_gad_transp'"", 'transp' ' ||,
  146.         ' CHECK = ""'txt_gad_dispose'"", 'dispose' ' ||,
  147.        ' CYCLE = ""'txt_gad_optimize'"", 3, 'optimization', ""'txt_gad_optimnone'"",""'txt_gad_optimbndy'"", ""'txt_gad_optimdelta'"" ' ||,  
  148.  ' CYCLE = ""'txt_gad_curglobal'"", 3, 'curglobal', ""'txt_gad_curglobal0'"", ""'txt_gad_curglobal1'"", ""'txt_gad_curglobal2'"" ' ||,
  149. ' VSPACE = 8 ' ||,
  150.  ' CYCLE = ""'txt_gad_operation'"", 2, 'operation',""'txt_gad_preview'"",  ""'txt_gad_final'"" '||,
  151.     ' VSPACE = 8 ' ||,
  152. ' CHECK = ""'txt_gad_drawrect'"", 'drawrect' ' ||,
  153. ' SEPARATOR ' ||,
  154.   ' CYCLE = ""'txt_gad_anbrush'"", 4, 'anbrush', ""'txt_gad_anbrushnone'"", ""'txt_gad_animload'"", ""'txt_gad_pickup'"",  ""'txt_gad_removecolor'"" "'  
  155.                    if rc~=0 then DO;SET '"BARS=0x3"'; EXIT 0;END
  156.          if rc = 0 then DO
  157.             loop = RESULT.1
  158.             transp = RESULT.2
  159.             dispose = RESULT.3
  160.             optimization = RESULT.4
  161.              curglobal = RESULT.5
  162.             operation = RESULT.6
  163.                drawrect = RESULT.7
  164.                 anbrush = RESULT.8
  165.                               END
  166. call setclip('loop' , loop)
  167. call setclip('transp', transp)
  168. call setclip('dispose', dispose)
  169. call setclip('operation', operation)
  170. call setclip('optimization', optimization)
  171. call setclip('drawrect', drawrect)
  172. call setclip('curglobal', curglobal)
  173. call setclip('anbrush', anbrush)
  174.  
  175. if anbrush = 1 then DO
  176.      GetBrushAttributes 'FRAMES'
  177.     frames = RESULT
  178.     IF frames < 2 then DO
  179.         Requestnotify 'PROMPT "You selected animbrush but there is no animbrush present.
  180.  We exit."'
  181.     SET '"BARS=0x3"'
  182.         EXIT 0
  183.         END
  184.     if frames ~< 2 then call BRUSHLOADER
  185.     END
  186.  
  187. if anbrush = 2 then DO
  188.         Getframes
  189.     frames = result
  190.     if frames < 2 then DO
  191.         Requestnotify 'PROMPT "You selected to pick up an animbrush but there is no animation present"'
  192.         SET '"BARS=0x3"'
  193.         EXIT
  194.         END
  195.     if X0 = "" then DO
  196.         Requestnotify 'PROMPT "No global rectangle is defined. We do not know what area to pick up."'
  197. SET '"BARS=0x3"'
  198.         EXIT
  199.         END 
  200.     call PICKUPABRUSH  /*does not continue to save as there is an anbrush=2 block*/
  201. END
  202.  
  203. if anbrush=3 then call MAKEOPAQUE
  204.  
  205.  
  206. if transp= 0 then SET '"TRANSP=0"'      
  207.  if transp=1 then SET '"TRANSP=1"'
  208. Getframes
  209. frames = result
  210. if frames <2 then DO
  211.     Requestnotify 'PROMPT "There is no animation to work on. Load an animation, or make
  212.  one from animbrush"'
  213.     SET '"BARS=0x3"'
  214.     EXIT
  215.     END
  216. if curglobal = 0 then DO
  217.         if X0 = "" then DO
  218.                     Requestnotify 'PROMPT "There  is no previous global rectangle
  219.  definition. You must define the global rectangle. Try again."'
  220.                     SET '"BARS=0x3"'
  221.                     EXIT
  222.                    END
  223.                     END
  224.  
  225. if  curglobal = 1 then call GLOBALAREA
  226. if curglobal = 2 then call DEFINERECT
  227.  
  228.  
  229. if operation = 1 then CALL PICKUPABRUSH   /*saveanimgif bypasses it all*/
  230.  
  231.  
  232. if optimization = 1 then DO
  233.     if transp =0 then Requestnotify 'PROMPT "Boundaries optimization in settings other
  234.  than transp=1 and dispose=1 may produce a webanim result different from the source Amiga
  235.  animation."'
  236. END
  237. if optimization = 2 then DO
  238.     if transp =1 then Requestnotify 'PROMPT "Deltas optimization in settings other than
  239.  transp=0 and dispose=0 may produce a webanim result different from the source Amiga
  240.  animation."'
  241. END
  242.  
  243. SWITCHENVIRONMENT          
  244. DELETEFRAMES ALL FORCE
  245. CLEARIMAGE
  246. if numcolors < 256 then numcolors2 = numcolors*2
  247. if numcolors = 256 then numcolors2 = numcolors
  248. Set 'FORCE "COLORS='numcolors2'"'
  249.     col = '153 153 153'
  250.     col2 = '204 204 204'
  251.     Setcolors 'FROM "'numcolors2-1'" COLORS "'col'"'
  252.      Setcolors 'FROM "'numcolors2-2'" C